package com.sg.service.biz.operation.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.operation.req.*;
import com.sg.dto.biz.operation.res.*;
import com.sg.dto.integration.app.AutoDeleteAddEvaTempDataComReqDto;
import com.sg.dto.integration.app.AutoDeleteAddEvaTempDataComRespDto;
import com.sg.dto.integration.app.QueryEvaTempListComBorderReqDto;
import com.sg.dto.integration.app.QueryEvaTempListComBorderRespDto;
import com.sg.service.base.operation.MOmsPlatformOperationSeparatedDataService;
import com.wicket.okrapp.integration.EvaThemeService;
import com.wicket.okrapp.integration.SystemTestDomainService;
import com.wicket.okrcomponent.integration.InterfaceModeService;
import com.wicket.okrcomponent.integration.dto.*;
import com.sg.common.exception.Assert;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class OperationsDeploymentServiceImpl
        implements com.wicket.okroperation.biz.service.OperationsDeploymentService {

    @Resource
    private RedisUtil redisUtil;
    //@Resource
    //private MMmmShellService mMmmShellService;
    @Resource
    private NbOperationsDeployment nbOperationsDeployment;
    @Resource
    private MOmsPlatformOperationSeparatedDataService mOmsPlatformOperationSeparatedDataService;
    //@Resource
    //private MOmsSchemeOpenRecordService mOmsSchemeOpenRecordService;
//@Resource
    //private MSpaceService mSpaceService;
//@Resource
    //private undefinedService undefinedService;
    @Resource
    private InterfaceModeService interfaceModeService;
    //@Resource
    //private MOmsEvaluationTemplateService mOmsEvaluationTemplateService;
    @Resource
    private EvaThemeService fwAppEvaThemeClient;
    @Resource
    private SystemTestDomainService fwAppSystemTestDomainClient;

    /**
     * D6执行动态寻表数据(公共)[7186]
     * gen by moon at 9/14/2023, 11:35:05 PM
     */
    @Trace(operationName = "D6执行动态寻表数据(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementDynamicLookupDataComRespDto implementDynamicLookupDataCom(ImplementDynamicLookupDataComReqDto reqDto) {


        QueryDynamicLookupDataComListRespDto dynamic_lookup_dataRes_1 = null;
//步骤0: M6查询动态寻表数据列表(特殊方法) - queryDynamicLookupDataList
        //ModelCode: dynamic_lookup_data
        QueryDynamicLookupDataComListRespDto dynamic_lookup_dataRes = null;
        QueryDynamicLookupDataComListReqDto dynamic_lookup_dataReq = new QueryDynamicLookupDataComListReqDto();
        if (reqDto != null) {
            dynamic_lookup_dataReq.setDatabaseIpAdress(reqDto.getDatabaseIpAdress());//SimpleFieldAssign//sourceId:1120591_1
            dynamic_lookup_dataReq.setDatabaseport(reqDto.getDatabaseport());//SimpleFieldAssign//sourceId:1120592_1
            dynamic_lookup_dataReq.setDatabaseName(reqDto.getDatabaseName());//SimpleFieldAssign//sourceId:1120689_1
            dynamic_lookup_dataReq.setDatabaseAccount(reqDto.getDatabaseAccount());//SimpleFieldAssign//sourceId:1120593_1
            dynamic_lookup_dataReq.setDatabasePassword(reqDto.getDatabasePassword());//SimpleFieldAssign//sourceId:1120594_1
            dynamic_lookup_dataReq.setToolTableEncryptionName(reqDto.getToolTableEncryptionName());//SimpleFieldAssign//sourceId:1032558_1
            dynamic_lookup_dataReq.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1032561_1
            dynamic_lookup_dataReq.setThemeContentId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1032560_1
            dynamic_lookup_dataReq.setCycleDataObjId(reqDto.getCycleDataObjId());//SimpleFieldAssign//sourceId:1032563_1
            dynamic_lookup_dataReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:1032562_1
        }

        /*M6查询动态寻表数据列表(特殊方法)[7187]  用于运维接口，根据设计工具加密表名、空间ID、模版ID，出参表主键ID */
        Assert.isNull(dynamic_lookup_dataReq.getToolTableEncryptionName(), "D6执行动态寻表数据(公共)-M6查询动态寻表数据列表(特殊方法)-设计工具加密表名不能为空", false);
        dynamic_lookup_dataRes = nbOperationsDeployment.queryDynamicLookupDataComList(dynamic_lookup_dataReq);


        dynamic_lookup_dataRes_1 = dynamic_lookup_dataRes;

        ImplementDynamicLookupDataComRespDto retData = new ImplementDynamicLookupDataComRespDto();
        if (dynamic_lookup_dataRes_1 != null) {
            retData.setDynamicLookupDataList(dynamic_lookup_dataRes_1.getDynamicLookupDataList().stream().map(item -> BeanUtil.toBean(item, DynamicLookupDataDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1032569_1
        }


        return retData;
    }

    /**
     * D6新增ngnix服务运行脚本[7112]
     * gen by moon at 6/2/2023, 3:10:02 PM
     */
    @Trace(operationName = "D6新增ngnix服务运行脚本")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddNgnixExecutionScriptRespDto addNgnixExecutionScript(AddNgnixExecutionScriptReqDto reqDto) {


        AddNgnixExecutionScriptRespDto ngnixModelRes_1 = null;
//步骤0: M6新增ngnix服务运行脚本（特殊方法） - addNgnixExecutionScript
        //ModelCode: ngnixModel
        AddNgnixExecutionScriptRespDto ngnixModelRes = null;
        AddNgnixExecutionScriptReqDto ngnixModelReq = new AddNgnixExecutionScriptReqDto();
        if (reqDto != null && reqDto.getRouterList() != null && !CollectionUtil.isEmpty(reqDto.getRouterList())) {
            ngnixModelReq.setRouterList(reqDto.getRouterList().stream().map(item -> BeanUtil.toBean(item, RouterDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1004194_1
        }
        if (reqDto != null) {
            ngnixModelReq.setDomainName(reqDto.getDomainName());//SimpleFieldAssign//sourceId:1004195_1
        }

        /*M6新增ngnix服务运行脚本（特殊方法）[7085]   */
        Assert.isNull(ngnixModelReq.getDomainName(), "D6新增ngnix服务运行脚本-M6新增ngnix服务运行脚本（特殊方法）-域名不能为空", false);
        ngnixModelRes = nbOperationsDeployment.addNgnixExecutionScript(ngnixModelReq);


        ngnixModelRes_1 = ngnixModelRes;

        AddNgnixExecutionScriptRespDto retData = new AddNgnixExecutionScriptRespDto();
        if (ngnixModelRes_1 != null) {
            retData.setScriptRelativePath(ngnixModelRes_1.getScriptRelativePath());//SimpleFieldAssign//sourceId:1004199_1
        }


        return retData;
    }

    /**
     * D6新增集群es服务运行脚本[7106]
     * gen by moon at 6/2/2023, 3:26:11 PM
     */
    @Trace(operationName = "D6新增集群es服务运行脚本")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddClusterEsExecutionScriptRespDto addClusterEsExecutionScript(AddClusterEsExecutionScriptReqDto reqDto) {


        AddClusterEsExecutionScriptRespDto clusterEsModelRes_1 = null;
//步骤0: M6新增集群es服务运行脚本（特殊方法） - addClusterEsExecutionScript
        //ModelCode: clusterEsModel
        AddClusterEsExecutionScriptRespDto clusterEsModelRes = null;
        AddClusterEsExecutionScriptReqDto clusterEsModelReq = new AddClusterEsExecutionScriptReqDto();
        if (reqDto != null) {
            clusterEsModelReq.setIsClusterDeployment(reqDto.getIsClusterDeployment());//SimpleFieldAssign//sourceId:1004301_1
            clusterEsModelReq.setIsMaster(reqDto.getIsMaster());//SimpleFieldAssign//sourceId:1004304_1
            clusterEsModelReq.setNodeIpAdressPortList(reqDto.getNodeIpAdressPortList());//list-field-assign//sourceId:1004302_1
        }

        /*M6新增集群es服务运行脚本（特殊方法）[7091]   */
        Assert.isNull(clusterEsModelReq.getIsClusterDeployment(), "D6新增集群es服务运行脚本-M6新增集群es服务运行脚本（特殊方法）-是否集群部署不能为空", false);
        Assert.isNull(clusterEsModelReq.getIsMaster(), "D6新增集群es服务运行脚本-M6新增集群es服务运行脚本（特殊方法）-当前节点是否为Master节点不能为空", false);
        clusterEsModelRes = nbOperationsDeployment.addClusterEsExecutionScript(clusterEsModelReq);


        clusterEsModelRes_1 = clusterEsModelRes;

        AddClusterEsExecutionScriptRespDto retData = new AddClusterEsExecutionScriptRespDto();
        if (clusterEsModelRes_1 != null) {
            retData.setScriptRelativePath(clusterEsModelRes_1.getScriptRelativePath());//SimpleFieldAssign//sourceId:1004308_1
        }


        return retData;
    }

    /**
     * D6新增单实例es服务运行脚本[7107]
     * gen by moon at 6/2/2023, 3:26:12 PM
     */
    @Trace(operationName = "D6新增单实例es服务运行脚本")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddEsExecutionScriptRespDto addEsExecutionScript(AddEsExecutionScriptReqDto reqDto) {


        AddEsExecutionScriptRespDto esModelRes_1 = null;
//步骤0: M6新增单实例es服务运行脚本（特殊方法） - addEsExecutionScript
        //ModelCode: esModel
        AddEsExecutionScriptRespDto esModelRes = null;
        AddEsExecutionScriptReqDto esModelReq = new AddEsExecutionScriptReqDto();
        if (reqDto != null) {
            esModelReq.setServerLaunchPort(reqDto.getServerLaunchPort());//SimpleFieldAssign//sourceId:1004287_1
            esModelReq.setEsLogCategoryAdress(reqDto.getEsLogCategoryAdress());//SimpleFieldAssign//sourceId:1004288_1
            esModelReq.setEsDataCategoryAdress(reqDto.getEsDataCategoryAdress());//SimpleFieldAssign//sourceId:1004289_1
        }

        /*M6新增单实例es服务运行脚本（特殊方法）[7090]   */
        Assert.isNull(esModelReq.getServerLaunchPort(), "D6新增单实例es服务运行脚本-M6新增单实例es服务运行脚本（特殊方法）-启动端口不能为空", false);
        Assert.isNull(esModelReq.getEsLogCategoryAdress(), "D6新增单实例es服务运行脚本-M6新增单实例es服务运行脚本（特殊方法）-es日志目录地址不能为空", false);
        Assert.isNull(esModelReq.getEsDataCategoryAdress(), "D6新增单实例es服务运行脚本-M6新增单实例es服务运行脚本（特殊方法）-es数据目录地址不能为空", false);
        esModelRes = nbOperationsDeployment.addEsExecutionScript(esModelReq);


        esModelRes_1 = esModelRes;

        AddEsExecutionScriptRespDto retData = new AddEsExecutionScriptRespDto();
        if (esModelRes_1 != null) {
            retData.setScriptRelativePath(esModelRes_1.getScriptRelativePath());//SimpleFieldAssign//sourceId:1004299_1
        }


        return retData;
    }

    /**
     * D6新增集群nacos服务运行脚本[7108]
     * gen by moon at 6/2/2023, 3:26:14 PM
     */
    @Trace(operationName = "D6新增集群nacos服务运行脚本")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddClusterNacosExecutionScriptRespDto addClusterNacosExecutionScript(AddClusterNacosExecutionScriptReqDto reqDto) {


        AddClusterNacosExecutionScriptRespDto clusterNacosModelRes_1 = null;
//步骤0: M6新增集群nacos服务运行脚本（特殊方法） - addClusterNacosExecutionScript
        //ModelCode: clusterNacosModel
        AddClusterNacosExecutionScriptRespDto clusterNacosModelRes = null;
        AddClusterNacosExecutionScriptReqDto clusterNacosModelReq = new AddClusterNacosExecutionScriptReqDto();
        if (reqDto != null) {
            clusterNacosModelReq.setIsClusterDeployment(reqDto.getIsClusterDeployment());//SimpleFieldAssign//sourceId:1004257_1
            clusterNacosModelReq.setServerLaunchPort(reqDto.getServerLaunchPort());//SimpleFieldAssign//sourceId:1004256_1
            clusterNacosModelReq.setNodeIpAdressPortList(reqDto.getNodeIpAdressPortList());//list-field-assign//sourceId:1004258_1
        }

        /*M6新增集群nacos服务运行脚本（特殊方法）[7089]   */
        Assert.isNull(clusterNacosModelReq.getIsClusterDeployment(), "D6新增集群nacos服务运行脚本-M6新增集群nacos服务运行脚本（特殊方法）-是否集群部署不能为空", false);
        Assert.isNull(clusterNacosModelReq.getServerLaunchPort(), "D6新增集群nacos服务运行脚本-M6新增集群nacos服务运行脚本（特殊方法）-启动端口不能为空", false);
        clusterNacosModelRes = nbOperationsDeployment.addClusterNacosExecutionScript(clusterNacosModelReq);


        clusterNacosModelRes_1 = clusterNacosModelRes;

        AddClusterNacosExecutionScriptRespDto retData = new AddClusterNacosExecutionScriptRespDto();
        if (clusterNacosModelRes_1 != null) {
            retData.setScriptRelativePath(clusterNacosModelRes_1.getScriptRelativePath());//SimpleFieldAssign//sourceId:1004263_1
        }


        return retData;
    }

    /**
     * D6新增apollo服务运行脚本[7110]
     * gen by moon at 6/2/2023, 3:26:15 PM
     */
    @Trace(operationName = "D6新增apollo服务运行脚本")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddApolloExecutionScriptRespDto addApolloExecutionScript(AddApolloExecutionScriptReqDto reqDto) {


        AddApolloExecutionScriptRespDto apolloModelRes_1 = null;
//步骤0: M6新增apollo服务运行脚本（特殊方法） - addApolloExecutionScript
        //ModelCode: apolloModel
        AddApolloExecutionScriptRespDto apolloModelRes = null;
        AddApolloExecutionScriptReqDto apolloModelReq = new AddApolloExecutionScriptReqDto();
        if (reqDto != null) {
            apolloModelReq.setConfigDatabaseAdress(reqDto.getConfigDatabaseAdress());//SimpleFieldAssign//sourceId:1004226_1
            apolloModelReq.setPortalDatabaseAdress(reqDto.getPortalDatabaseAdress());//SimpleFieldAssign//sourceId:1004227_1
            apolloModelReq.setConfigServerPort(reqDto.getConfigServerPort());//SimpleFieldAssign//sourceId:1004228_1
            apolloModelReq.setRegisterServePort(reqDto.getRegisterServePort());//SimpleFieldAssign//sourceId:1004225_1
            apolloModelReq.setPortalServerPort(reqDto.getPortalServerPort());//SimpleFieldAssign//sourceId:1004229_1
        }

        /*M6新增apollo服务运行脚本（特殊方法）[7087]   */
        Assert.isNull(apolloModelReq.getConfigDatabaseAdress(), "D6新增apollo服务运行脚本-M6新增apollo服务运行脚本（特殊方法）-配置数据库地址不能为空", false);
        Assert.isNull(apolloModelReq.getPortalDatabaseAdress(), "D6新增apollo服务运行脚本-M6新增apollo服务运行脚本（特殊方法）-门户数据库地址不能为空", false);
        Assert.isNull(apolloModelReq.getConfigServerPort(), "D6新增apollo服务运行脚本-M6新增apollo服务运行脚本（特殊方法）-配置服务端口不能为空", false);
        Assert.isNull(apolloModelReq.getRegisterServePort(), "D6新增apollo服务运行脚本-M6新增apollo服务运行脚本（特殊方法）-注册服务端口不能为空", false);
        Assert.isNull(apolloModelReq.getPortalServerPort(), "D6新增apollo服务运行脚本-M6新增apollo服务运行脚本（特殊方法）-门户服务端口不能为空", false);
        apolloModelRes = nbOperationsDeployment.addApolloExecutionScript(apolloModelReq);


        apolloModelRes_1 = apolloModelRes;

        AddApolloExecutionScriptRespDto retData = new AddApolloExecutionScriptRespDto();
        if (apolloModelRes_1 != null) {
            retData.setScriptRelativePath(apolloModelRes_1.getScriptRelativePath());//SimpleFieldAssign//sourceId:1004236_1
        }


        return retData;
    }

    /**
     * D6新增skywalking服务运行脚本[7111]
     * gen by moon at 6/2/2023, 3:26:17 PM
     */
    @Trace(operationName = "D6新增skywalking服务运行脚本")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddSkywalkingExecutionScriptRespDto addSkywalkingExecutionScript(AddSkywalkingExecutionScriptReqDto reqDto) {


        AddSkywalkingExecutionScriptRespDto skywalkingModelRes_1 = null;
//步骤0: M6新增skywalking服务运行脚本（特殊方法） - addSkywalkingExecutionScript
        //ModelCode: skywalkingModel
        AddSkywalkingExecutionScriptRespDto skywalkingModelRes = null;
        AddSkywalkingExecutionScriptReqDto skywalkingModelReq = new AddSkywalkingExecutionScriptReqDto();
        if (reqDto != null) {
            skywalkingModelReq.setDatabaseAdress(reqDto.getDatabaseAdress());//SimpleFieldAssign//sourceId:1004207_1
            skywalkingModelReq.setEsAdress(reqDto.getEsAdress());//SimpleFieldAssign//sourceId:1004206_1
            skywalkingModelReq.setCollectServerLaunchPort(reqDto.getCollectServerLaunchPort());//SimpleFieldAssign//sourceId:1004208_1
            skywalkingModelReq.setPortalServerLaunchPort(reqDto.getPortalServerLaunchPort());//SimpleFieldAssign//sourceId:1004209_1
        }

        /*M6新增skywalking服务运行脚本（特殊方法）[7086]   */
        Assert.isNull(skywalkingModelReq.getDatabaseAdress(), "D6新增skywalking服务运行脚本-M6新增skywalking服务运行脚本（特殊方法）-数据库地址不能为空", false);
        Assert.isNull(skywalkingModelReq.getEsAdress(), "D6新增skywalking服务运行脚本-M6新增skywalking服务运行脚本（特殊方法）-es地址不能为空", false);
        Assert.isNull(skywalkingModelReq.getCollectServerLaunchPort(), "D6新增skywalking服务运行脚本-M6新增skywalking服务运行脚本（特殊方法）-采集服务启动端口不能为空", false);
        Assert.isNull(skywalkingModelReq.getPortalServerLaunchPort(), "D6新增skywalking服务运行脚本-M6新增skywalking服务运行脚本（特殊方法）-门户服务启动端口不能为空", false);
        skywalkingModelRes = nbOperationsDeployment.addSkywalkingExecutionScript(skywalkingModelReq);


        skywalkingModelRes_1 = skywalkingModelRes;

        AddSkywalkingExecutionScriptRespDto retData = new AddSkywalkingExecutionScriptRespDto();
        if (skywalkingModelRes_1 != null) {
            retData.setScriptRelativePath(skywalkingModelRes_1.getScriptRelativePath());//SimpleFieldAssign//sourceId:1004215_1
        }


        return retData;
    }

    /**
     * D6执行动态寻表删除数据(公共)[7190]
     * gen by moon at 9/14/2023, 11:35:10 PM
     */
    @Trace(operationName = "D6执行动态寻表删除数据(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementDynamicLookupDeleteDataComRespDto implementDynamicLookupDeleteDataCom(ImplementDynamicLookupDeleteDataComReqDto reqDto) {


        //步骤0: M6批量动态寻表删除数据(特殊方法) - batchDeleteDynamicLookupDeleteData
        //ModelCode: dynamicLookupDeleteData
        BatchDeleteDynamicLookupDeleteDataRespDto dynamicLookupDeleteDataRes = null;
        BatchDeleteDynamicLookupDeleteDataReqDto dynamicLookupDeleteDataReq = new BatchDeleteDynamicLookupDeleteDataReqDto();
        if (reqDto != null) {
            dynamicLookupDeleteDataReq.setDatabaseIpAdress(reqDto.getDatabaseIpAdress());//SimpleFieldAssign//sourceId:1120607_1
            dynamicLookupDeleteDataReq.setDatabaseport(reqDto.getDatabaseport());//SimpleFieldAssign//sourceId:1120608_1
            dynamicLookupDeleteDataReq.setDatabaseName(reqDto.getDatabaseName());//SimpleFieldAssign//sourceId:1120686_1
            dynamicLookupDeleteDataReq.setDatabaseAccount(reqDto.getDatabaseAccount());//SimpleFieldAssign//sourceId:1120609_1
            dynamicLookupDeleteDataReq.setDatabasePassword(reqDto.getDatabasePassword());//SimpleFieldAssign//sourceId:1120610_1
            dynamicLookupDeleteDataReq.setToolTableEncryptionName(reqDto.getToolTableEncryptionName());//SimpleFieldAssign//sourceId:1035875_1
            dynamicLookupDeleteDataReq.setEntityName(reqDto.getEntityName());//SimpleFieldAssign//sourceId:1035884_1
            dynamicLookupDeleteDataReq.setDynamicLookupDataList(reqDto.getDynamicLookupDataList());//list-field-assign//sourceId:1035202_1
        }

        /*M6批量动态寻表删除数据(特殊方法)[7191]   */
        Assert.isNull(dynamicLookupDeleteDataReq.getToolTableEncryptionName(), "D6执行动态寻表删除数据(公共)-M6批量动态寻表删除数据(特殊方法)-设计工具加密表名不能为空", false);
        Assert.isNull(dynamicLookupDeleteDataReq.getEntityName(), "D6执行动态寻表删除数据(公共)-M6批量动态寻表删除数据(特殊方法)-内容表主键字段英文名不能为空", false);
        dynamicLookupDeleteDataRes = nbOperationsDeployment.batchDeleteDynamicLookupDeleteData(dynamicLookupDeleteDataReq);


        ImplementDynamicLookupDeleteDataComRespDto retData = new ImplementDynamicLookupDeleteDataComRespDto();


        return retData;
    }

    /**
     * D6执行私有化分离数据(公共)[7193]
     * gen by moon at 9/14/2023, 11:35:16 PM
     */
    @Trace(operationName = "D6执行私有化分离数据(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementPrivatizationAndSeparationDataComRespDto implementPrivatizationAndSeparationDataCom(ImplementPrivatizationAndSeparationDataComReqDto reqDto) {


        QueryAcceptParametersDetailRespDto receptionServiceRes_1 = null;
//virtualUsage D2获取数据集按入参过滤指定记录(公共)  48489
        ObtainDataFilterSpecRecByComRespDto obtainDataFilterSpecRecByComRespDto = null;
        ObtainDataFilterSpecRecByComReqDto obtainDataFilterSpecRecByComReqDto = new ObtainDataFilterSpecRecByComReqDto();
        if (reqDto != null) {
            obtainDataFilterSpecRecByComReqDto.setDataFilterSpecRecByList(reqDto.getSpaceList().stream().map(p -> {
                DataFilterSpecRecByDto elm = new DataFilterSpecRecByDto();
                elm.setComTxtField(p);
                return elm;
            }).collect(Collectors.toList()));//list-field-assign//sourceId:1120323_1_48489
            obtainDataFilterSpecRecByComReqDto.setComTxtField(reqDto.getTenantSpaceId());//SimpleFieldAssign//sourceId:1120322_1_48489
        }

        /*D2获取数据集按入参过滤指定记录(公共)[7387]   */
        Assert.isNull(obtainDataFilterSpecRecByComReqDto.getComTxtField(), "D6执行私有化分离数据(公共)-D2获取数据集按入参过滤指定记录(公共)-通用文本字段不能为空", false);
        obtainDataFilterSpecRecByComRespDto = interfaceModeService.obtainDataFilterSpecRecByCom(obtainDataFilterSpecRecByComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


//virtualUsage M6接收空间列表（特殊方法）  48490
        //ModelCode: receptionService
        QueryAcceptParametersDetailRespDto receptionServiceRes = null;
        if (obtainDataFilterSpecRecByComRespDto != null) {
            QueryAcceptParametersDetailReqDto receptionServiceReq = new QueryAcceptParametersDetailReqDto();
            if (obtainDataFilterSpecRecByComRespDto != null) {
                receptionServiceReq.setSpaceList(obtainDataFilterSpecRecByComRespDto.getDataFilterSpecRecByList().stream().map(p -> p.getComTxtField()).collect(Collectors.toList()));//list-field-assign//sourceId:1120357_1_48490
            }
            if (reqDto != null) {
                receptionServiceReq.setTenantSpaceId(reqDto.getTenantSpaceId());//SimpleFieldAssign//sourceId:1120359_1_48490
            }

            /*M6接收空间列表（特殊方法）[6711]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq.getTenantSpaceId(), "D6执行私有化分离数据(公共)-M6接收空间列表（特殊方法）-租户空间ID不能为空", false);
            receptionServiceRes = nbOperationsDeployment.queryAcceptParametersDetail(receptionServiceReq);


            receptionServiceRes_1 = receptionServiceRes;
        }
//virtualUsage M6执行空间发牌【循环开始】  45260
        //ModelCode: circulationCollections
        for (String circulationCollectionsRes : receptionServiceRes.getSpaceList()) {

//virtualUsage D6执行动态寻表数据(公共)  45262
            ImplementDynamicLookupDataComRespDto implementDynamicLookupDataComRespDto = null;
            ImplementDynamicLookupDataComReqDto implementDynamicLookupDataComReqDto = new ImplementDynamicLookupDataComReqDto();
            if (reqDto != null) {
                implementDynamicLookupDataComReqDto.setDatabaseIpAdress(reqDto.getDatabaseIpAdress());//SimpleFieldAssign//sourceId:1120599_1_45262
                implementDynamicLookupDataComReqDto.setDatabaseport(reqDto.getDatabaseport());//SimpleFieldAssign//sourceId:1120600_1_45262
                implementDynamicLookupDataComReqDto.setDatabaseName(reqDto.getDatabaseName());//SimpleFieldAssign//sourceId:1120694_1_45262
                implementDynamicLookupDataComReqDto.setDatabaseAccount(reqDto.getDatabaseAccount());//SimpleFieldAssign//sourceId:1120601_1_45262
                implementDynamicLookupDataComReqDto.setDatabasePassword(reqDto.getDatabasePassword());//SimpleFieldAssign//sourceId:1120602_1_45262
                implementDynamicLookupDataComReqDto.setToolTableEncryptionName(reqDto.getToolTableEncryptionName());//SimpleFieldAssign//sourceId:1035886_1_45262
            }
            if (circulationCollectionsRes != null) {
                implementDynamicLookupDataComReqDto.setSpaceId(circulationCollectionsRes);//SimpleFieldAssign//sourceId:1035890_1_45262
            }

            /*D6执行动态寻表数据(公共)[7186]   */
            Assert.isNull(implementDynamicLookupDataComReqDto.getToolTableEncryptionName(), "D6执行私有化分离数据(公共)-D6执行动态寻表数据(公共)-设计工具加密表名不能为空", false);
            Assert.isNull(implementDynamicLookupDataComReqDto.getSpaceId(), "D6执行私有化分离数据(公共)-D6执行动态寻表数据(公共)-创建于空间ID不能为空", false);
            implementDynamicLookupDataComRespDto = implementDynamicLookupDataCom(implementDynamicLookupDataComReqDto)/*vcase invoke 同服务,同domain*/;


//virtualUsage D6执行动态寻表删除数据(公共)  45263
            ImplementDynamicLookupDeleteDataComRespDto implementDynamicLookupDeleteDataComRespDto = null;
            if (implementDynamicLookupDataComRespDto != null) {
                ImplementDynamicLookupDeleteDataComReqDto implementDynamicLookupDeleteDataComReqDto = new ImplementDynamicLookupDeleteDataComReqDto();
                if (reqDto != null) {
                    implementDynamicLookupDeleteDataComReqDto.setDatabaseIpAdress(reqDto.getDatabaseIpAdress());//SimpleFieldAssign//sourceId:1120615_1_45263
                    implementDynamicLookupDeleteDataComReqDto.setDatabaseport(reqDto.getDatabaseport());//SimpleFieldAssign//sourceId:1120616_1_45263
                    implementDynamicLookupDeleteDataComReqDto.setDatabaseName(reqDto.getDatabaseName());//SimpleFieldAssign//sourceId:1120695_1_45263
                    implementDynamicLookupDeleteDataComReqDto.setDatabaseAccount(reqDto.getDatabaseAccount());//SimpleFieldAssign//sourceId:1120617_1_45263
                    implementDynamicLookupDeleteDataComReqDto.setDatabasePassword(reqDto.getDatabasePassword());//SimpleFieldAssign//sourceId:1120618_1_45263
                    implementDynamicLookupDeleteDataComReqDto.setToolTableEncryptionName(reqDto.getToolTableEncryptionName());//SimpleFieldAssign//sourceId:1036569_1_45263
                    implementDynamicLookupDeleteDataComReqDto.setEntityName(reqDto.getEntityName());//SimpleFieldAssign//sourceId:1036570_1_45263
                }
                if (implementDynamicLookupDataComRespDto != null && implementDynamicLookupDataComRespDto.getDynamicLookupDataList() != null && !CollectionUtil.isEmpty(implementDynamicLookupDataComRespDto.getDynamicLookupDataList())) {
                    implementDynamicLookupDeleteDataComReqDto.setDynamicLookupDataList(implementDynamicLookupDataComRespDto.getDynamicLookupDataList().stream().map(item -> item.getConEntityId())
                            .collect(Collectors.toList()));/*list-to-strings*///sourceId:1036568_1_45263
                }

                /*D6执行动态寻表删除数据(公共)[7190]   */
                Assert.isNull(implementDynamicLookupDeleteDataComReqDto.getToolTableEncryptionName(), "D6执行私有化分离数据(公共)-D6执行动态寻表删除数据(公共)-设计工具加密表名不能为空", false);
                Assert.isNull(implementDynamicLookupDeleteDataComReqDto.getEntityName(), "D6执行私有化分离数据(公共)-D6执行动态寻表删除数据(公共)-内容表主键字段英文名不能为空", false);
                implementDynamicLookupDeleteDataComRespDto = implementDynamicLookupDeleteDataCom(implementDynamicLookupDeleteDataComReqDto)/*vcase invoke 同服务,同domain*/;


            }
//virtualUsage M6执行平台运营【循环结束】  48488
            //ModelCode: circulationEnd
        }

//virtualUsage M6修改租户分离数据  45265
        boolean bOOLEAN;
        OmsPlatformOperationSeparatedData omsPlatformOperationSeparatedData = new OmsPlatformOperationSeparatedData();
        omsPlatformOperationSeparatedData.setDataSeparatedStatus("HAVE_COMPLETED");//sourceId:1036581_1_45265
        if (reqDto != null) {
            omsPlatformOperationSeparatedData.setOperationSeparatedDataId(reqDto.getOperationSeparatedDataId());//SimpleFieldAssign//sourceId:1036579_1_45265
        }

        /*M6修改租户分离数据[7206]   */
        Assert.isNull(omsPlatformOperationSeparatedData.getOperationSeparatedDataId(), "D6执行私有化分离数据(公共)-M6修改租户分离数据-分离数据表主键ID不能为空", false);
        Assert.isNull(omsPlatformOperationSeparatedData.getDataSeparatedStatus(), "D6执行私有化分离数据(公共)-M6修改租户分离数据-数据分离状态不能为空", false);
        bOOLEAN = mOmsPlatformOperationSeparatedDataService.updateTenantSeparationData(omsPlatformOperationSeparatedData)/*vcase invoke 本地 method 方法调用;*/;


        ImplementPrivatizationAndSeparationDataComRespDto retData = new ImplementPrivatizationAndSeparationDataComRespDto();
        if (receptionServiceRes_1 != null) {
            retData.setSpaceList(receptionServiceRes_1.getSpaceList());//list-field-assign//sourceId:1120366_1
        }


        return retData;
    }

    /**
     * D6执行清洗垃圾评价数据(公共)[7192]
     * gen by moon at 9/13/2023, 10:41:10 PM
     */
    @Trace(operationName = "D6执行清洗垃圾评价数据(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementCleaningWasteEvaluationDataComRespDto implementCleaningWasteEvaluationDataCom(ImplementCleaningWasteEvaluationDataComReqDto reqDto) {


        QueryAcceptParametersDetailRespDto receptionServiceRes_1 = null;
//virtualUsage D6执行动态寻表数据(公共)  45231
        ImplementDynamicLookupDataComRespDto implementDynamicLookupDataComRespDto = null;
        ImplementDynamicLookupDataComReqDto implementDynamicLookupDataComReqDto = new ImplementDynamicLookupDataComReqDto();
        if (reqDto != null) {
            implementDynamicLookupDataComReqDto.setToolTableEncryptionName(reqDto.getToolTableEncryptionName());//SimpleFieldAssign//sourceId:1035227_1_45231
            implementDynamicLookupDataComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1035228_1_45231
            implementDynamicLookupDataComReqDto.setThemeContentId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1035229_1_45231
            implementDynamicLookupDataComReqDto.setCycleDataObjId(reqDto.getCycleDataObjId());//SimpleFieldAssign//sourceId:1035230_1_45231
        }

        /*D6执行动态寻表数据(公共)[7186]   */
        Assert.isNull(implementDynamicLookupDataComReqDto.getToolTableEncryptionName(), "D6执行清洗垃圾评价数据(公共)-D6执行动态寻表数据(公共)-设计工具加密表名不能为空", false);
        implementDynamicLookupDataComRespDto = implementDynamicLookupDataCom(implementDynamicLookupDataComReqDto)/*vcase invoke 同服务,同domain*/;


//virtualUsage D2执行数据集记录去重(公共)  45232
        ImplementDataSetDuplicateRemovalComRespDto implementDataSetDuplicateRemovalComRespDto = null;
        if (implementDynamicLookupDataComRespDto != null) {
            ImplementDataSetDuplicateRemovalComReqDto implementDataSetDuplicateRemovalComReqDto = new ImplementDataSetDuplicateRemovalComReqDto();
            if (implementDynamicLookupDataComRespDto != null && implementDynamicLookupDataComRespDto.getDynamicLookupDataList() != null && !CollectionUtil.isEmpty(implementDynamicLookupDataComRespDto.getDynamicLookupDataList())) {
                implementDataSetDuplicateRemovalComReqDto.setDataSetDuplicateRemovalList(implementDynamicLookupDataComRespDto.getDynamicLookupDataList().stream().map(item -> item.getEvaluationTemplateId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:1035237_1_45232
            }

            /*D2执行数据集记录去重(公共)[5138]   */

            implementDataSetDuplicateRemovalComRespDto = interfaceModeService.implementDataSetDuplicateRemovalCom(implementDataSetDuplicateRemovalComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        }
//virtualUsage D3查询评价模板列表(公共)(边界)  48493
        QueryEvaTempListComBorderRespDto queryEvaTempListComBorderRespDto = null;
        QueryEvaTempListComBorderReqDto queryEvaTempListComBorderReqDto = new QueryEvaTempListComBorderReqDto();
        queryEvaTempListComBorderReqDto.setIsArchive("FALSE");//sourceId:1120442_1_48493

        /*D3查询评价模板列表(公共)(边界)[7388]   */
        Assert.isNull(queryEvaTempListComBorderReqDto.getIsArchive(), "D6执行清洗垃圾评价数据(公共)-D3查询评价模板列表(公共)(边界)-是否存档不能为空", false);
        queryEvaTempListComBorderRespDto = fwAppEvaThemeClient.queryEvaTempListComBorder(queryEvaTempListComBorderReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


//virtualUsage D2执行数据集差集(公共)  45236
        ImplementCollectionsDiffComRespDto implementCollectionsDiffComRespDto = null;
        if (implementDataSetDuplicateRemovalComRespDto != null && queryEvaTempListComBorderRespDto != null) {
            ImplementCollectionsDiffComReqDto implementCollectionsDiffComReqDto = new ImplementCollectionsDiffComReqDto();
            if (implementDataSetDuplicateRemovalComRespDto != null) {
                implementCollectionsDiffComReqDto.setCollectionsDiffComFatList(implementDataSetDuplicateRemovalComRespDto.getDataSetDuplicateRemovalList());//list-field-assign//sourceId:1035819_1_45236
            }
            if (queryEvaTempListComBorderRespDto != null) {
                implementCollectionsDiffComReqDto.setCollectionsDiffComSubList(queryEvaTempListComBorderRespDto.getEvalTempList());//list-field-assign//sourceId:1035818_1_45236
            }

            /*D2执行数据集差集(公共)[7197]   */

            implementCollectionsDiffComRespDto = interfaceModeService.implementCollectionsDiffCom(implementCollectionsDiffComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        }
//virtualUsage M6接收评价模板列表(特殊方法)  48492
        //ModelCode: receptionService
        QueryAcceptParametersDetailRespDto receptionServiceRes = null;
        if (implementCollectionsDiffComRespDto != null) {
            QueryAcceptParametersDetailReqDto receptionServiceReq = new QueryAcceptParametersDetailReqDto();
            if (implementCollectionsDiffComRespDto != null) {
                receptionServiceReq.setEvalTempList(implementCollectionsDiffComRespDto.getCollectionsDiffList());//list-field-assign//sourceId:1120403_1_48492
            }
            if (reqDto != null) {
                receptionServiceReq.setTureOrFalse(reqDto.getTureOrFalse());//SimpleFieldAssign//sourceId:1120412_1_48492
                receptionServiceReq.setCreateInductionId(reqDto.getCreateInductionId());//SimpleFieldAssign//sourceId:1120409_1_48492
                receptionServiceReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:1120410_1_48492
                receptionServiceReq.setAppId(reqDto.getAppId());//SimpleFieldAssign//sourceId:1120411_1_48492
            }

            /*M6接收评价模板列表(特殊方法)[6711]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq.getTureOrFalse(), "D6执行清洗垃圾评价数据(公共)-M6接收评价模板列表(特殊方法)-是否不能为空", false);
            Assert.isNull(receptionServiceReq.getCreateInductionId(), "D6执行清洗垃圾评价数据(公共)-M6接收评价模板列表(特殊方法)-创建人就职记录ID不能为空", false);
            Assert.isNull(receptionServiceReq.getSpaceId(), "D6执行清洗垃圾评价数据(公共)-M6接收评价模板列表(特殊方法)-创建于空间ID不能为空", false);
            Assert.isNull(receptionServiceReq.getAppId(), "D6执行清洗垃圾评价数据(公共)-M6接收评价模板列表(特殊方法)-创建于联盟应用ID不能为空", false);
            receptionServiceRes = nbOperationsDeployment.queryAcceptParametersDetail(receptionServiceReq);


            receptionServiceRes_1 = receptionServiceRes;
        }
        if ((receptionServiceRes != null && receptionServiceRes.getEvalTempList() != null && receptionServiceRes.getEvalTempList().size() > 0 && reqDto != null && reqDto.getTureOrFalse() != null && reqDto.getTureOrFalse().equals("TRUE"))) {
            //if((M6接收评价模板列表(特殊方法).评价模板列表数据集条数 大于 0 and D6执行清洗垃圾评价数据(公共).是否 等于 是))  45238

//ModelCode: circulationCollections
            for (String circulationCollectionsRes : receptionServiceRes.getEvalTempList()) {

                AutoDeleteAddEvaTempDataComRespDto autoDeleteAddEvaTempDataComRespDto = null;
                AutoDeleteAddEvaTempDataComReqDto autoDeleteAddEvaTempDataComReqDto = new AutoDeleteAddEvaTempDataComReqDto();
                if (circulationCollectionsRes != null) {
                    autoDeleteAddEvaTempDataComReqDto.setEvaluationTemplateId(circulationCollectionsRes);//SimpleFieldAssign//sourceId:1035272_1_45241
                }
                if (reqDto != null) {
                    autoDeleteAddEvaTempDataComReqDto.setCreateInductionId(reqDto.getCreateInductionId());//SimpleFieldAssign//sourceId:1035273_1_45241
                    autoDeleteAddEvaTempDataComReqDto.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:1035274_1_45241
                    autoDeleteAddEvaTempDataComReqDto.setAppId(reqDto.getAppId());//SimpleFieldAssign//sourceId:1035275_1_45241
                }

                /*D3-一键删除评价模板验证数据(公共)[4207]   */
                Assert.isNull(autoDeleteAddEvaTempDataComReqDto.getEvaluationTemplateId(), "D6执行清洗垃圾评价数据(公共)-D3-一键删除评价模板验证数据(公共)-评价模板ID不能为空", false);
                Assert.isNull(autoDeleteAddEvaTempDataComReqDto.getCreateInductionId(), "D6执行清洗垃圾评价数据(公共)-D3-一键删除评价模板验证数据(公共)-创建人就职记录ID 不能为空", false);
                Assert.isNull(autoDeleteAddEvaTempDataComReqDto.getSpaceId(), "D6执行清洗垃圾评价数据(公共)-D3-一键删除评价模板验证数据(公共)-创建于空间ID不能为空", false);
                Assert.isNull(autoDeleteAddEvaTempDataComReqDto.getAppId(), "D6执行清洗垃圾评价数据(公共)-D3-一键删除评价模板验证数据(公共)-创建于联盟应用ID不能为空", false);
                autoDeleteAddEvaTempDataComRespDto = fwAppSystemTestDomainClient.autoDeleteAddEvaTempDataCom(autoDeleteAddEvaTempDataComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


//ModelCode: circulationEnd
            }

        }
        ImplementCleaningWasteEvaluationDataComRespDto retData = new ImplementCleaningWasteEvaluationDataComRespDto();
        if (receptionServiceRes_1 != null) {
            retData.setCleaningWasteEvaluationDataList(receptionServiceRes_1.getEvalTempList());//list-field-assign//sourceId:1120425_1
        }


        return retData;
    }
    //
}
